// Copyright (c) 2025 The Msp Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <stdint.h>
#include <string>
#include "msp/type.h"

namespace msp{

class Value{
public:
    virtual ~Value() = default;
    virtual bool ParseValue(uint8_t data,int32_t len) = 0;
    virtual ValueType GetType() const = 0;
    virtual std::string ToStdString() = 0;
};

class BoolValue : public Value{
public:
    BoolValue();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    bool _value;
};

class CharValue : public Value{
public:
    CharValue();
    
    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    char _value;
};

class Int8Value : public Value{
public:
    Int8Value();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    int8_t _value;
};

class Int16Value : public Value{
public:
    Int16Value();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    int16_t _value;
};

class Int32Value : public Value{
public:
    Int32Value();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    int32_t _value;
};

class Int64Value : public Value{
public:
    Int64Value();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    int64_t _value;
};

class FloatValue : public Value{
public:
    FloatValue();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    float _value;
};

class StringValue : public Value{
public:
    StringValue();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    std::string _value;
};

class BytesValue : public Value{
public:
    BytesValue();
    ~BytesValue();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    int _length;
    uint8_t *_value;
};

class DateTimeValue : public Value{
public:
    DateTimeValue();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
private:
    uint64_t _date;
    uint64_t _time;
};

class ObjectValue : public Value{
public:
    ObjectValue();

    virtual bool ParseValue(uint8_t data,int32_t len);
    virtual ValueType GetType() const;
    virtual std::string ToStdString();
};

};
